<template>
  <div>
    <el-container style="height: 100vh">
      <el-aside class="aside" :style="{width:`${isCollapse?65:240}px`, transition: '0.4s'}">
        <el-menu 
          router
          :default-active="$route.path"
          background-color="#345"
          text-color="#bbb"
          :style="{height: '100vh'}"
          :collapse="isCollapse"
          class="el-menu-vertical-demo">
          <el-menu-item>
            <img width="30px" src="../assets/logo.svg" alt="">
            <template slot="title">
              <span style="font-size: 1.2em; color:#efefef; font-weight: bold;">&nbsp;&nbsp;稻香村后台管理</span>
            </template>
          </el-menu-item>
          <el-menu-item index="/home/index">
            <i class="el-icon-message"></i>
            <template slot="title">
              首页
            </template>
          </el-menu-item>
          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span slot="title">产品管理</span>
            </template>
            <el-menu-item index="/home/product-list">
              <i class="el-icon-notebook-2"></i>
              <span slot="title">产品列表</span>
            </el-menu-item>
            <el-menu-item index="/home/product-add">
              <i class="el-icon-plus"></i>
              <span slot="title">新增产品</span>
            </el-menu-item>
          </el-submenu>
          <el-submenu index="3">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span slot="title">我的管理</span>
            </template>
            <el-menu-item index="/home/fzjg-list">
              <i class="el-icon-notebook-2"></i>
              <span slot="title">分支机构列表</span>
            </el-menu-item>
            <el-menu-item index="/home/fzjg-add">
              <i class="el-icon-plus"></i>
              <span slot="title">新增分支机构</span>
            </el-menu-item>
            <el-menu-item index="/home/jgc-list">
              <i class="el-icon-notebook-2"></i>
              <span slot="title">加工厂列表</span>
            </el-menu-item>
            <el-menu-item index="/home/jgc-add">
              <i class="el-icon-plus"></i>
              <span slot="title">新增加工厂</span>
            </el-menu-item>
          </el-submenu>
          <el-submenu index="4">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span slot="title">品牌管理</span>
            </template>
            <el-menu-item index="/home/lishi-list">
              <i class="el-icon-notebook-2"></i>
              <span slot="title">品牌历史列表</span>
            </el-menu-item>
            <el-menu-item index="/home/lishi-add">
              <i class="el-icon-plus"></i>
              <span slot="title">新增品牌历史</span>
            </el-menu-item>
            <el-menu-item index="/home/rongyu-list">
              <i class="el-icon-notebook-2"></i>
              <span slot="title">品牌荣誉列表</span>
            </el-menu-item>
            <el-menu-item index="/home/rongyu-add">
              <i class="el-icon-plus"></i>
              <span slot="title">新增品牌荣誉</span>
            </el-menu-item>
          </el-submenu>

        </el-menu>
      </el-aside>

      <el-container>
        <el-header class="header">
          <i v-show="!isCollapse" class="el-icon-s-fold" @click="isCollapse=true"></i>
          <i v-show="isCollapse" class="el-icon-s-unfold" @click="isCollapse=false"></i>
          <span>未登录</span>
        </el-header>

        <el-main>
          <!-- 二级路由所需要显示的内容 -->
          <router-view />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
export default {
  data() {
    return {
      isCollapse: false
    }
  },
};
</script>

<style lang="scss" scoped>
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #ccc;

  i {
    font-size: 1.3em;
  }
}
.aside::-webkit-scrollbar {
  display: none;
}
.el-menu-vertical-demo:not(.el-menu--collapse) {
    width: 240px;
    min-height: 400px;
  }
</style>
